package 观察者模式;

import java.util.ArrayList;
import java.util.List;

public class Boss1 extends Subject {
    public String SubjectState;
    private List<Observer> observers = new ArrayList<>();
    @Override
    void Attach(Observer observer) {
        observers.add(observer);
    }

    @Override
    void Detach(Observer observer) {
        observers.remove(observer);
    }

    @Override
    void Notify() {
        for(Observer observer:observers){
            observer.Update();
        }
    }

    @Override
    public String getSubjectState() {
        return SubjectState;
    }

    @Override
    public void setSubjectState(String subjectState) {
        SubjectState = subjectState;
    }
}
